<!--#begin caloptions -->
<form method="post" action="{ babPhpSelf }">
<input type="hidden" name="tg" value="calopt" />
<input type="hidden" name="idx" value="options" />
<input type="hidden" name="urla" value="{ urla }" />
<input type="hidden" name="modify" value="options" />


<!--#if calweekwork -->

<table  width="80%"  border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground" align="center" valign="middle"> 

	<table  width="100%" border="0" cellspacing="0" cellpadding="10" class="BabLoginMenuBackground">
	<tr valign="top"> 
		<td>
		
			<div id="bab_calopt_days">
			
				<h4>{ t_working_hours }</h4>
				
				<!--#in getnextshortday -->
				<div class="bab_calopt_day">
					<h5>{ shortday }</h5>
					<table id="bab_calopt_day_{ dayid }">
						<tr>
							<td><span>00</span></td>
							<td><span>01</span></td>
							<td><span>02</span></td>
							<td><span>03</span></td>
							<td><span>04</span></td>
							<td><span>05</span></td>
							<td><span>06</span></td>
							<td><span>07</span></td>
							<td><span>08</span></td>
							<td><span>09</span></td>
							<td><span>10</span></td>
							<td><span>11</span></td>
							<td><span>12</span></td>
							<td><span>13</span></td>
							<td><span>14</span></td>
							<td><span>15</span></td>
							<td><span>16</span></td>
							<td><span>17</span></td>
							<td><span>18</span></td>
							<td><span>19</span></td>
							<td><span>20</span></td>
							<td><span>21</span></td>
							<td><span>22</span></td>
							<td><span>23</span></td>
						</tr>
					</table>
					
					<input type="text" class="workinghours" id="workinghours_{ dayid }" name="workinghours[{ dayid }]" value="{ workinghours }" />
					
					<label for="dispdays_{ dayid }">{ t_dispday }</label> : 
					<input  type="checkbox" name="dispdays[]" id="dispdays_{ dayid }" value="{ dayid }"  { disp_selected } />
				</div>
				<!--#endin getnextshortday -->

			</div>
			<script type="text/javascript">
				function bab_calopt_browse(callback) {
					days = document.getElementById('bab_calopt_days').getElementsByTagName('table');
					for (var i = 0 ; i < days.length; i++) {
						tds = days[i].getElementsByTagName('td');
						for (var j = 0; j < tds.length; j++) {
							callback(days[i], tds[j]);
						}
					}
				}


				function bab_calopt_clearclass(td) {
					
					ctd = td;
					cc = td.className;
					
					while (ctd) {
						if (ctd.nodeName == 'TD' && cc != ctd.className) {
							break;
						}
						ctd = ctd.previousSibling;
					}

					if (ctd) {
						ctd = ctd.nextSibling;
					} else {
						ctd = td.parentNode.firstChild;
					}
					

					while (ctd) {
						if (ctd.nodeName == 'TD') {
							if (cc != ctd.className) {
								break;
							}
							ctd.className = '';
						}
						ctd = ctd.nextSibling;
					}
				}
				
				function bab_calopt_hourToInt(str) {
					if ('0' == str.substring(0,1)) {
						str = str.substring(1,2);
					}
					return parseInt(str);
				}
				
				/**
				 * @return int
				 */
				function bab_calopt_tdVal(td) {
					span = td.childNodes[0];
					while (span.nodeType != 1) {
						span = span.nextSibling;
					}
					return bab_calopt_hourToInt(span.innerHTML);
				}
				
				
				function bab_calopt_tableToText(table) {
				
					var tds = table.getElementsByTagName('td');
					var currentval = null;
					var currentstart = null;
					var periods = new Array();
					for(var i = 0; i < tds.length; i++) {

						val = bab_calopt_tdVal(tds[i]);
						
						
						if (null == currentval && 'selected' == tds[i].className) {
							//start period
							currentval = val;
							currentstart = val;
							
						} else if (currentval+1 == val && 'selected' == tds[i].className) {
							currentval = val;
							
						} else if (null != currentstart) {
							// add period
							periods[periods.length] = currentstart+'-'+val;
							currentstart = null;
							currentval = null;
						} 
					}
					
					
					
					var wday = table.id.substring(table.id.length-1,table.id.length);
					var field = document.getElementById('workinghours_'+wday);
					field.value = periods.join(',');
				}
				
				
				function bab_calopt_click_td(td) {
				
					table = td;
					while (table && table.nodeName != 'TABLE') {
						table = table.parentNode;
					}


					if ('selected' == td.className) {
						bab_calopt_clearclass(td);
						bab_calopt_tableToText(table);
						return;
					}

					wtd = window['bab_calopt_lastclick_td'];

					if (window['bab_calopt_lastclick_table'] == table && 
						bab_calopt_tdVal(wtd) <= bab_calopt_tdVal(td)) {


						bab_calopt_browse(function(table, td) {
							if ('waiting' == td.className) {
								td.className = '';
							}
						});
						


						while (td != wtd) {
							wtd.className = 'selected';
							wtd = wtd.nextSibling;
						}
						
						wtd.className = 'selected';
						
						window['bab_calopt_lastclick_table'] = null;
						window['bab_calopt_lastclick_td'] = null;
					} else {
						window['bab_calopt_lastclick_table'] = table;
						window['bab_calopt_lastclick_td'] = td;
						td.className = 'waiting';
					}
					
					bab_calopt_tableToText(table);
				}


				function bab_calopt_init() {

					window['bab_calopt_lastclick_table'] = null;
					window['bab_calopt_lastclick_td'] = null;

					bab_calopt_browse(function(table, td) {
						td.onclick=function() {
							bab_calopt_click_td(this);
						};
					}
					);
					
					for (var i = 0 ; i <= 6; i++) {
					
						var field = document.getElementById('workinghours_'+i).value;
						
						if (field) {
							var periods = field.split(',');
							var table = document.getElementById('bab_calopt_day_'+i);
							var tds = table.getElementsByTagName('td');
							
							for(var j = 0; j < periods.length; j++) {
								var hours = periods[j].split('-');
	
								var begin = hours[0].split(':');
								var end = hours[1].split(':');
								
								begin = bab_calopt_hourToInt(begin[0]);
								end = bab_calopt_hourToInt(end[0])-1;
								
								bab_calopt_click_td(tds[begin]);
								bab_calopt_click_td(tds[end]);
							}
						}
					}
				}


				bab_calopt_init();
			</script>
		
		
		</td>
	</tr>

	
	</table>
</td>
</tr>
</table>
<br />

<!--#endif calweekwork -->


<table  width="80%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground" align="center" valign="middle"> 
	<table  width="100%" border="0" cellspacing="0" cellpadding="5" class="BabLoginMenuBackground">
	<tr> 
	<td  colspan="2">
		<h5>{ caloptionstxt }</h5>
		
	</td>
	</tr>
	<tr align="center"> 
		<td colspan="2">
			<table border="1" cellspacing="0" cellpadding="5" >
				<tr align="center">
				<td nowrap>{ startdaytxt }</td>
				<td nowrap>{ starttimetxt }</td>
				<td nowrap>{ endtimetxt }</td>
				</tr>
				<tr align="center">
				<td>
				<select name="startday">
				<!--#in getnextday -->
				<option value="{ dayid }" { selected }>{ dayname }</option>
				<!--#endin getnextday -->
				</select>
				</td>
				<td>
				<select name="starttime">
				<!--#in getnexttime -->
				<option value="{ timeid }" { selected }>{ timeval }</option>
				<!--#endin getnexttime -->
				</select>
				</td>
				<td>
				<select name="endtime">
				<!--#in getnexttime -->
				<option value="{ timeid }" { selected }>{ timeval }</option>
				<!--#endin getnexttime -->
				</select>
				</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr> 
		<td align="right">{ allday }</td>
		<td> 
			<select name="allday">
				<option value="Y" <!--#if arr[allday] "== Y" -->selected<!--#endif arr[allday] -->>{ yes }</option>
				<option value="N" <!--#if arr[allday] "== N" -->selected<!--#endif arr[allday] -->>{ no }</option>
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right">{ usebgcolor }</td>
		<td> 
			<select name="usebgcolor">
				<option value="Y" <!--#if arr[usebgcolor] "== Y" -->selected<!--#endif arr[usebgcolor] -->>{ yes }</option>
				<option value="N" <!--#if arr[usebgcolor] "== N" -->selected<!--#endif arr[usebgcolor] -->>{ no }</option>
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right">{ showupdateinfo }</td>
		<td> 
			<select name="showupdateinfo">
				<option value="Y" <!--#if arr[show_update_info] "== Y" -->selected<!--#endif arr[show_update_info] -->>{ yes }</option>
				<option value="N" <!--#if arr[show_update_info] "== N" -->selected<!--#endif arr[show_update_info] -->>{ no }</option>
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right">{ elapstime }</td>
		<td> 
			<select name="elapstime">
			<!--#in getnextet -->
			<option value="{ etval }" { etselected }>{ etval }&nbsp;{ minutes }</option>
			<!--#endin getnextet -->
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right" valign="middle">{ defaultview }</td>
		<td> 
			<select name="defaultview">
			<!--#in getnextdv -->
			<option value="{ dvvalid }" { dvselected }>{ dvval }</option>
			<!--#endin getnextdv -->
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right" valign="middle">{ t_defaultCalAccess }</td>
		<td> 
			<select name="iDefaultCalendarAccess">
				<!--#in getNextCalAccess -->
				<option value="{ iCalAccess }" { sCalAccessSelected } /> { sCalAccess }</option>
				<!--#endin getNextCalAccess -->
			</select>
		</td>
	</tr>
	<tr> 
		<td align="right">{ showonlydaysmonthinfo }</td>
		<td> 
			<select name="showonlydaysmonthinfo">
				<option value="Y" <!--#if arr[show_onlydays_of_month] "== Y" -->selected<!--#endif arr[show_onlydays_of_month] -->>{ yes }</option>
				<option value="N" <!--#if arr[show_onlydays_of_month] "== N" -->selected<!--#endif arr[show_onlydays_of_month] -->>{ no }</option>
			</select>
		</td>
	</tr>
	<!--#if allbackends -->
	<tr>
		<td colspan="2">
			<br />
		
			<h5>{ t_calendar_backend }</h5>
			
			
			<table class="calendar-backend-options" align="center" cellspacing="0" cellpadding="3" >
		
			<!--#in getNextBackend -->
			<tr>
				<td><label><input type="radio" name="calendar_backend" value="{ name }" <!--#if selected --> checked="checked"<!--#endif selected --> /> 
				{ description }</label>
				</td>
				<td>
				&nbsp; 
				<!--#if optionsurl -->
				<button onclick="bab_popup('{ optionsurl }');return false;">{ t_options }</button>
				<!--#else optionsurl -->
				<button disabled="disabled">{ t_options }</button>
				<!--#endif optionsurl -->
				</td>
			</tr>
			<!--#endin getNextBackend -->
			</table>
		</td>
	</tr>
	<!--#endif allbackends -->
	</table>
</td>
</tr>
</table>
<br>
<div align="center">
	<input type="submit" name="submit" value="{ modify }" />
</div>
</form>
<!--#end caloptions -->









<!--#begin access -->
<br />
<br />
<br />
<form name="accform" method="post" action="{ babPhpSelf }">
<input type="hidden" name="tg" value="calopt" />
<input type="hidden" name="idx" value="access" />
<input type="hidden" name="idcal" value="{ calid }" />
<input type="hidden" name="urla" value="{ urla }" />
<input type="hidden" name="update" value="access" />
<table  width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground" align="center" valign="middle"> 
	<table  width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr class="BabSiteAdminTitleFontBackground" align="center"> 
	<td>{ fullname }</td>
	<td>{ access0txt }</td>
	<td>{ access1txt }</td>
	<td>{ access11txt }</td>
	<td>{ access2txt }</td>
	<td>{ access22txt }</td>
	<td>{ deletetxt }</td>
	</tr>
	<!--#in getnext -->
	<tr class="BabSiteAdminFontBackground" align="center"> 
	<td align="left">{ fullnameval }</td>
	<td><input type="radio" name="acc_{ userid }" value="0" { cheched0 } /></td>
	<td><input type="radio" name="acc_{ userid }" value="1" { cheched1 } /></td>
	<td><input type="radio" name="acc_{ userid }" value="3" { cheched11 } /></td>
	<td><input type="radio" name="acc_{ userid }" value="2" { cheched2 } /></td>
	<td><input type="radio" name="acc_{ userid }" value="4" { cheched21 } /></td>
	<td><input type="checkbox" name="users[]" value="{ userid }" /></td>
	</tr>
	<!--#endin getnext -->
	<tr> 
	<td class="BabSiteAdminTitleFontBackground" colspan="7">&nbsp;</td>
	</tr>
	</table>
</td>
</tr>
</table>
<div align="center"><br><input type="submit" name="submit" value="{ upduserstxt }" /></div>
</form>


<!--#end access -->



<!--#begin calendarchoice -->

<script type="text/javascript">
<!--
function submitCtrl(form)
	{
	if (typeof calendarChoice_selectAll == 'function')
		{
		return calendarChoice_selectAll(form.name);
		}
	}

function calview()
	{
	document.forms['calendarchoice'].database_record.value = 0;
	if (typeof calendarChoice_selectAll == 'function')
		{
		if (calendarChoice_selectAll('calendarchoice'))
			document.forms['calendarchoice'].submit();
		}
	
	
	}

//-->
</script>

<form name="calendarchoice" method="post" action="{ babPhpSelf }" onsubmit="return(submitCtrl(this))">
<input type="hidden" name="tg" value="calopt" />
<input type="hidden" name="idx" value="unload" />
<input type="hidden" name="database_record" value="1" />
<input type="hidden" name="backurl" value="{ backurl }" />

<table width="98%" width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
	<tr>
		<td align="center">
			{ calendars }<br />
			<!--#if BAB_SESS_LOGGED -->
			<input type="submit" value="{ t_record }" />
			<!--#endif BAB_SESS_LOGGED -->
			<input type="button" value="{ t_view }" onclick="calview()" />
		</td>
	</tr>
</table>
<script type="text/javascript">
<!--
function resize_select()
	{
	var sel = document.forms['calendarchoice'].getElementsByTagName('select');
	
	for(var i = 0 ; i < sel.length ; i++ )
		{
		sel[i].style.height = screen.height/2;
		}
	}

resize_select();
//-->
</script>
</form>
<!--#end calendarchoice -->

<!--#begin unload -->
<script type="text/javascript">
<!--
setTimeout("this.close()","1000");
//}
this.opener.location.href='{ backurl }';
//-->
</script>
<br />
<br />
<br />
<div align="center">{ message }</div>
<!--#end unload -->










<!--#begin calendarBackend -->

<script type="text/javascript">
bab_initFunctions.push(function() {

	document.getElementById('bab_cal_copy_source').onclick = function() {
		bloc = document.getElementById('bab_cal_start_copy_from');
		if (document.getElementById('bab_cal_copy_source').checked)
		{
			bloc.style.display = 'block';
		}
		else
		{
			bloc.style.display = 'none';
		}
	};

	document.getElementById('bab_cal_copy_source').click();
	
});
</script>

<form method="post" action="{ babPhpSelf }">
	<input type="hidden" name="tg" value="calopt" />
	<input type="hidden" name="idx" value="options" />
	<input type="hidden" name="urla" value="{ urla }" />
	<input type="hidden" name="calendar_backend" value="{ calendar_backend }" />
	<input type="hidden" name="confirm" value="1" />
	
	<table  width="80%" border="0" cellspacing="0" cellpadding="2" align="center">
	<tr> 
	<td class="BabLoginCadreBackground" align="center" valign="middle"> 
		<table  width="100%" border="0" cellspacing="0" cellpadding="10" class="BabLoginMenuBackground">
		<tr>
			<td align="left">
			
				<h5>{ t_intro }</h5>

				<p>
					<label><input type="checkbox" name="delete_destination" value="1" />&nbsp;{ t_option_delete_destination }</label>
				</p>
				<p>
					<label><input type="checkbox" name="copy_source" id="bab_cal_copy_source" value="1" />&nbsp;{ t_option_copy_source }</label>
				</p>
				<blockquote id="bab_cal_start_copy_from">
					<label>{ t_start_copy_from } : 
						<select name="start_copy_from">
							<!--#in getnextstart -->
							<option value="{ value }">{ option }</option>
							<!--#endin getnextstart -->
						</select>
					</label>
				</blockquote>
				
				<p align="center">
					<input type="submit" value="{ t_submit }" />
				</p>
			</td>
		</tr>
		</table>
	</td>
	</tr>
	</table>

</form>
<!--#end calendarBackend -->